#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>

typedef bool wire;

typedef struct Reg {
    bool value;     // The current value stored in the flip-flop
    wire *in;       // Pointer to the input wire
    wire *out;      // Pointer to the output wire
}Reg;

// 与非门， 是门电路的基础。用与非门可以构建其他门电路
#define NAND(X, Y)  (!((X) && (Y)))     

#define NOT(X)      (NAND(X, 1))            // 非门
#define AND(X, Y)   (NOT(NAND(X, Y)))       // 与门
#define OR(X, Y)    (NAND(NOT(X), NOT(Y)))  // 或门


#define CLOCK_CYCLE while(1)
